<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:69:"/www/wwwroot/xunda-college/application/atxunda/view/course/index.html";i:1700617175;s:69:"/www/wwwroot/xunda-college/application/atxunda/view/index/header.html";i:1700617178;}*/ ?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title>后台管理系统</title>
<link rel="stylesheet" href="__PUBLIC__css/pintuer.css?v=1.0">
<link rel="stylesheet" href="__PUBLIC__admin/admin.css">
<link rel="stylesheet" href="__PUBLIC__layui/css/layui.css">
<script src="__PUBLIC__js/jquery.js"></script>
<script src="__PUBLIC__js/pintuer.js"></script>
<script src="__PUBLIC__js/cookie.js"></script>
<script src="__PUBLIC__layui/layui.js"></script>
</head>
<style type="text/css">
	.refresh{width: 20px;height: 20px;float: right;margin:10px 20px;display: block;}
</style>
</head>
<?php if(request()->controller() != 'Index'): ?><img src="__PUBLIC__images/refresh.png" class="refresh" title="刷新"><?php endif; ?>
<script type="text/javascript">
	$('.refresh').click(function(){layer.msg('刷新中……');window.location.reload();})
</script>
<script type="text/javascript">
	function openwinx(url,name,w,h) {
		if(!w) w=screen.width-4;
		if(!h) h=screen.height-95;
		window.open(url,name,"width=" + w + ",height=" + h + ",toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no");
	}
</script>
<style type="text/css">
.box_kuang{width:240px;height:40px;position:absolute;top:35px;left:0;z-index:11;display:none}
.box_kuang a{background: #0ae;color: #fff !important;cursor: pointer;}
.testpapers{cursor: pointer;}
</style>
<body>
	<form method="post" action="" id="listform">
		<div class="panel admin-panel">
			<div class="panel-head"><strong class="icon-reorder"> 内容列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
			<div class="padding border-bottom">
				<ul class="search" style="padding-left:10px;">
					<li> <a class="button border-main icon-plus-square-o" href="<?php echo url('course/edit'); ?>"> 添加内容</a> </li>
					<li>搜索：</li>
					<li>
						<select name="nav_id" class="input" style="width:200px; line-height:17px;" onchange="changeNav()" >
							<option value="0">请选择课程</option>
							<?php if(is_array($nav_data) || $nav_data instanceof \think\Collection): if( count($nav_data)==0 ) : echo "" ;else: foreach($nav_data as $key=>$nav): ?>
							<option value="<?php echo $nav['nav_id']; ?>" <?php if($nav['nav_id'] == $param['nav_id']): ?>selected=""<?php endif; ?>><?php echo $nav['nav_name']; ?></option>
							<?php endforeach; endif; else: echo "" ;endif; ?>
						</select>
					</li>
					<li>
						<select name="type_id" class="input" style="width:200px; line-height:17px;" onchange="changesearch()">
							<option value="0">请选择阶段</option>
							<?php if(is_array($type_data) || $type_data instanceof \think\Collection): if( count($type_data)==0 ) : echo "" ;else: foreach($type_data as $key=>$type): ?>
							<option value="<?php echo $type['type_id']; ?>"  <?php if($type['type_id'] == $param['type_id']): ?>selected=""<?php endif; ?>><?php echo $type['type_name']; ?></option>
							<?php endforeach; endif; else: echo "" ;endif; ?>
						</select>
					</li>
					<li>
						<select name="s_id" class="input" style="width:200px; line-height:17px;" onchange="changesearch()">
							<option value="0">请选择章节</option>
							<?php if(is_array($s_data) || $s_data instanceof \think\Collection): if( count($s_data)==0 ) : echo "" ;else: foreach($s_data as $key=>$s): ?>
							<option value="<?php echo $s['s_id']; ?>"  <?php if($s['s_id'] == $param['s_id']): ?>selected=""<?php endif; ?>><?php echo $s['s_name']; ?><?php echo returnSpecifcShow($s['s_show']); ?></option>
							<?php endforeach; endif; else: echo "" ;endif; ?>
						</select>
					</li>
					<li>
						<input type="checkbox" name="is_show" value="1" onclick="changesearch()" <?php if($param['is_show'] == 1): ?>checked="" <?php endif; ?>>章节隐藏不显示
					</li>
					<li>
						<input type="text" placeholder="请输入搜索关键字" name="keywords" class="input" style="width:250px; line-height:17px;display:inline-block" value="<?php echo $param['keywords']; ?>" />
						<input type="text" placeholder="请输入视频id" name="vid" class="input" style="width:250px; line-height:17px;display:inline-block" value="<?php echo $param['vid']; ?>" />
						<a href="javascript:void(0)" class="button border-main icon-search" onclick="changesearch()" > 搜索</a>
					</li>
				</ul>
			</div>
			<table class="table table-hover text-center">
				<tr>
					<th>ID</th>
					<th>排序</th>
					<th>名称</th>
					<th>发布者</th>
					<th>更新时间</th>
					<th>专业</th>
					<th>阶段</th>
					<th>章节</th>
					<th width="310">操作</th>
				</tr>
				<?php if(is_array($data) || $data instanceof \think\Collection): if( count($data)==0 ) : echo "" ;else: foreach($data as $key=>$v): ?>
				<tr>
					<td><input type="checkbox" name="course_id[]" value="<?php echo $v['course_id']; ?>" />
					<?php echo $v['course_id']; ?></td>
					<td><input type="text" name="course_sort[<?php echo $v['course_id']; ?>]" value="<?php echo $v['course_sort']; ?>" style="width:50px; text-align:center; border:1px solid #ddd; padding:7px 0;" /></td>
					<td><a href="/learnings/<?php echo $v['course_id']; ?>.html" target="_blank"><?php echo $v['course_name']; ?></a></td>
					<td><?php echo $v['admin_name']; ?></td>
					<td><?php echo $v['updated_time']; ?></td>
					<td><font color="#00CC99"><?php echo $v['nav_name']; ?></font></td>
					<td><font color="#00CC99"><?php echo $v['type_name']; ?></font></td>
					<td><font color="#00CC99"><?php echo $v['s_name']; ?></font></td>
					<td>
						<div class="button-group"> 
							<?php if($admin['role_id'] != 12): ?><a class="button border-main" href="<?php echo url('course/edit',['id' => $v['course_id']]); ?>"><span class="icon-edit"></span> 修改</a> 
							<a class="button border-red" href="<?php echo url('course/delete',['course_id' => $v['course_id']]); ?>"  onclick="if(confirm('确定删除?')==false)return false;"><span class="icon-trash-o"></span> 删除</a> <?php endif; ?>
						</div>
					</td>
				</tr>
				<?php endforeach; endif; else: echo "" ;endif; ?>
				<tr>
					<td style="text-align:left; padding:19px 0;padding-left:20px;"><input type="checkbox" id="checkall"/>
					全选 </td>
					<td colspan="20" style="text-align:left;padding-left:20px;"><a href="javascript:void(0)" class="button border-red icon-trash-o" style="padding:5px 15px;" onclick="DelSelect()"> 删除</a> <a href="javascript:void(0)" style="padding:5px 15px; margin:0 10px;" class="button border-blue icon-edit" onclick="sorts()"> 排序</a>
						排序数字减 <input type="number" style="width:50px;font-size: 14px;padding: 10px;border: solid 1px #ddd;line-height: 20px;border-radius: 3px;-webkit-appearance: none;" name="sort_num" value="0">
					</td>
				</tr>
				<tr>
					<td colspan="9"><?php if($data): ?><?php echo $data->render(); endif; ?></td>
				</tr>
			</table>
		</div>
		<input type="hidden" name="status" value="">
	</form>
	<script type="text/javascript">
		function changesearch(){  
			$('input[name=status]').val('select');
			$("#listform").submit();
		}
		function changeNav(){
			$('input[name=status]').val('select');
			$("#listform").submit();
		}
		$("#checkall").click(function(){ 
			$("input[name='course_id[]']").each(function(){
				if (this.checked) {
					this.checked = false;
				}
				else {
					this.checked = true;
				}
			});
		})
		function DelSelect(){
			var Checkbox=false;
			$("input[name='course_id[]']").each(function(){
				if (this.checked==true) {   
					Checkbox=true;  
				}
			});
			if (Checkbox){
				var t=confirm("您确认要删除选中的内容吗？");
				if (t==false) return false;   
				$('input[name=status]').val('del');
				$("#listform").submit();    
			}
			else{
				alert("请选择您要删除的内容!");
				return false;
			}
		}
		function sorts(){
			var Checkbox=false;
			$("input[name='course_id[]']").each(function(){
				if (this.checked==true) {   
					Checkbox=true;  
				}
			});
			if (Checkbox){  
				$('input[name=status]').val('sort');
				$("#listform").submit();    
			}
			else{
				alert("请选择要操作的内容!");
				return false;
			}
		}
		function changecate(o){
			var Checkbox=false;
			$("input[name='course_id[]']").each(function(){
				if (this.checked==true) {   
					Checkbox=true;  
				}
			});
			var sCopyId = $(".sCopy").val();
			if(sCopyId == 0)return false;
			if (Checkbox){    
				$('input[name=status]').val('copy');
				$("#listform").submit();    
			}
			else{
				alert("请选择要操作的内容!");

				return false;
			}
		}
		$('#nav').change(function(){
			var nav_id = $(this).val();
			$("#type option:gt(0)").remove();
			$("#s option:gt(0)").remove();
			if(nav_id == ''){
				return;
			}
			$.ajax({
				type:'GET',
				url :"<?php echo url('course/getType'); ?>",
				data:'nav_id='+nav_id,
				dataType:'json',
				success : function(data){
					$.each(data, function(k,v){
						$('#type').append('<option value="'+v.type_id+'">'+v.type_name+'</option>');
					});
				}
			});
		});
		$('#type').change(function(){
			var type_id = $(this).val();
			$("#s option:gt(0)").remove();
			if(type_id == ''){
				return;
			}
			$.ajax({
				type:'GET',
				url :"<?php echo url('getS'); ?>",
				data:'type_id='+type_id,
				dataType:'json',
				success : function(data){
					$.each(data, function(k,v){
						$('#s').append('<option value="'+v.s_id+'">'+v.s_name+'</option>');
					});
				}
			});
		});
	</script>
</body>
</html>